package com.smartrobot.controller;

import org.springframework.stereotype.Controller;

import com.smartrobot.beans.Analysis;
import com.smartrobot.beans.ProcessResult;
import com.smartrobot.conversation.IAnalyser;

@Controller
public class IndexController extends BaseController{

	@Override
	public IAnalyser getAnalyser() {
		return new IndexAnalyser();
	}
	
	public class IndexAnalyser implements IAnalyser{

		@Override
		public Analysis analyse(String input) {
			Analysis ana=new Analysis();
			if(input.equals("index") 
			  || input.equals("-i")){
				ana.setHandleable(true);
			}
			return ana;
		}

		@Override
		public String getBeanName() {
			return "indexController";
		}
		
	}

	@Override
	public ProcessResult processMessage(String message) {
		ProcessResult pr=new ProcessResult();
		pr.setViewName("indexView");
		pr.addValue("hello", "hello world");
		return pr;
	}

}
